package router

import (
	"github.com/julienschmidt/httprouter"
)


type Route struct {
	Url string
	Handler httprouter.Handle
	Method  string
}

type Routers struct {
	Routes []Route
}

func (r *Routers) AddRoute(url string,method string,handle httprouter.Handle)  {
	router:=Route{
		Url:url,
		Method:method,
		Handler:handle,
	}
    r.Routes=append(r.Routes,router)
}

func (r *Routers) RegisterHandle() *httprouter.Router {
   routeObj:=httprouter.New()
	for _,v := range r.Routes{
		routeObj.Handle(v.Method, v.Url, v.Handler)
	}
	return routeObj
}